from abc import ABC, abstractmethod

class BaseProvider(ABC):
    def __init__(self, base_url=None, api_key=None, timeout=60):
        self.base_url = base_url
        self.api_key = api_key
        self.timeout = timeout

    @abstractmethod
    def chat(self, model: str, prompt: str, **kwargs) -> str:
        """调用大语言模型生成回复"""
        pass

    @abstractmethod
    def embed(self, model: str, text: str, **kwargs) -> list[float]:
        """调用向量嵌入模型"""
        pass

    @abstractmethod
    def chat_stream(self, model: str, prompt: str, **kwargs):
        """调用大语言模型流式生成回复
        返回一个迭代器或生成器，每次yield一小段输出
        """
        pass
